home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3x / cpusetGetNameList.z / cpusetGetNameList
Encoding:
Text File  |  2002-10-03  |  5.9 KB  |  133 lines

  1.  
  2.  
  3.  
  4. ccccppppuuuusssseeeettttGGGGeeeettttNNNNaaaammmmeeeeLLLLiiiisssstttt((((3333xxxx))))                                    ccccppppuuuusssseeeettttGGGGeeeettttNNNNaaaammmmeeeeLLLLiiiisssstttt((((3333xxxx))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      cpusetGetNameList - get the list of names for all defined cpusets
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ccccppppuuuusssseeeetttt....hhhh>>>>
  13.  
  14.      ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt ****ccccppppuuuusssseeeettttGGGGeeeettttNNNNaaaammmmeeeeLLLLiiiisssstttt((((vvvvooooiiiidddd))));;;;
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The _c_p_u_s_e_t_G_e_t_N_a_m_e_L_i_s_t function is used to obtain a list of the names for
  18.      all the cpusets on the system.
  19.  
  20.      The function returns a pointer to a structure of type ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt
  21.      (defined in <cpuset.h>).  The function _c_p_u_s_e_t_G_e_t_N_a_m_e_L_i_s_t allocates the
  22.      memory for the structure and all of its associated data.  The user is
  23.      responsible for freeing the memory using the function
  24.      _c_p_u_s_e_t_F_r_e_e_N_a_m_e_L_i_s_t(3x).  The ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt structure is defined as
  25.      follows:
  26.  
  27.                typedef struct {
  28.                    int    count;
  29.                    char   **list;
  30.                    int   *status;
  31.                } cpuset_NameList_t;
  32.  
  33.  
  34.      ccccoooouuuunnnntttt is the number of cpuset names in the list.
  35.  
  36.      lllliiiisssstttt references the list of names.
  37.  
  38.      ssssttttaaaattttuuuussss is a list of status flags that indicate the status of the
  39.      corresponding cpuset name in lllliiiisssstttt.  The following flag values may be
  40.      used:
  41.  
  42.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______QQQQ_UUUU_EEEE_UUUU_EEEE______NNNN_AAAA_MMMM_EEEE
  43.             Indicates that the corresponding name in lllliiiisssstttt is the name of a
  44.             cpuset queue.
  45.  
  46.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______CCCC_PPPP_UUUU______NNNN_AAAA_MMMM_EEEE
  47.             Indicates that the corresponding name in lllliiiisssstttt is the CPU ID for a
  48.             restricted CPU.
  49.  
  50.      The memory for lllliiiisssstttt and ssssttttaaaattttuuuussss is allocated when the ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt is
  51.      allocated and it is released when the ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt structure is
  52.      released.
  53.  
  54. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  55.      This example obtains the list of names for all cpuset queues configured
  56.      on the system.  The list  of cpusets or restricted CPU IDs is then
  57.      printed.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ccccppppuuuusssseeeettttGGGGeeeettttNNNNaaaammmmeeeeLLLLiiiisssstttt((((3333xxxx))))                                    ccccppppuuuusssseeeettttGGGGeeeettttNNNNaaaammmmeeeeLLLLiiiisssstttt((((3333xxxx))))
  71.  
  72.  
  73.  
  74.                cpuset_NameList_t *names;
  75.  
  76.                /* Get the list of names else print error & exit */
  77.                if ( !(names = cpusetGetNameList()) ) {
  78.                    perror("cpusetGetNameList");
  79.                    exit(1);
  80.                }
  81.                if (names->count == 0) {
  82.                    printf("No defined CPUSETs or restricted CPUs\n");
  83.                } else {
  84.                    int i;
  85.  
  86.                    printf("CPUSET and restricted CPU names:\n");
  87.                    for (i = 0; i < names->count; i++) {
  88.                        if (names->status[i] == CPUSET_CPU_NAME) {
  89.                            printf("CPU_ID[%s]\n", names->list[i]);
  90.                        } else {
  91.                            printf("CPUSET[%s]\n", names->list[i]);
  92.                        }
  93.                    }
  94.                }
  95.                cpusetFreeNameList(names);
  96.  
  97.  
  98. NNNNOOOOTTTTEEEESSSS
  99.      _c_p_u_s_e_t_G_e_t_N_a_m_e_L_i_s_t is found in the library "libcpuset.so", and will be
  100.      loaded if the option _----_llll_cccc_pppp_uuuu_ssss_eeee_tttt is used with _cccc_cccc(1) or _llll_dddd(1).
  101.  
  102. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  103.      cpuset(1), cpusetFreeNameList(3x), cpuset(5).
  104.  
  105. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  106.      If successful, _c_p_u_s_e_t_G_e_t_N_a_m_e_L_i_s_t returns a pointer to a ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt
  107.      structure.  If _c_p_u_s_e_t_G_e_t_N_a_m_e_L_i_s_t fails, it returns NULL and eeeerrrrrrrrnnnnoooo is set
  108.      to indicate the error.  The possible values for eeeerrrrrrrrnnnnoooo include those
  109.      values set by _s_y_s_m_p(2) and _s_b_r_k(2).
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.